import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'package:xsdk_flutter/xsdk_splashAd.dart';
import 'package:xsdk_flutter/xsdk_videoAd.dart';

import 'xsdk_flutter_method_channel.dart';
import 'xsdk_banner.dart';

typedef Future<dynamic> EventHandler(String event);

abstract class XsdkFlutterPlatform extends PlatformInterface {
  /// Constructs a XsdkFlutterPlatform.
  XsdkFlutterPlatform() : super(token: _token);

  static final Object _token = Object();

  static XsdkFlutterPlatform _instance = MethodChannelXsdkFlutter();

  /// The default instance of [XsdkFlutterPlatform] to use.
  ///
  /// Defaults to [MethodChannelXsdkFlutter].
  static XsdkFlutterPlatform get instance => _instance;

  /// Platform-specific implementations should set this with their own
  /// platform-specific class that extends [XsdkFlutterPlatform] when
  /// they register themselves.
  static set instance(XsdkFlutterPlatform instance) {
    PlatformInterface.verifyToken(instance, _token);
    _instance = instance;
  }

  onPush({
    required EventHandler onRegisterSucceed,
    required EventHandler onNotificationMessageClicked,
    required EventHandler onNotificationMessageArrived,
  }) {
    throw UnimplementedError('platformVersion() has not been implemented.');
  }

  Future<String?> getPlatformVersion() {
    throw UnimplementedError('platformVersion() has not been implemented.');
  }

  Future<void> init() {
    throw UnimplementedError('platformVersion() has not been implemented.');
  }

  // 是否存在某个sdk
  Future<bool?> hasSDK({required String service, required String provider}) {
    throw UnimplementedError('hasSDK has not been implemented.');
  }

  Future<bool?> isInitSDK({required String service, required String provider}) {
    throw UnimplementedError('isInitSDK has not been implemented.');
  }

  Future<String?> initSDK(Map data) {
    throw UnimplementedError('hasSDK has not been implemented.');
  }

  // 是否存在某个sdk
  Future<String?> login(Map data) {
    throw UnimplementedError('hasSDK has not been implemented.');
  }

  Future<String?> logout(Map data) {
    throw UnimplementedError('hasSDK has not been implemented.');
  }

  Future<String?> finishPay(Map data) {
    throw UnimplementedError('hasSDK has not been implemented.');
  }

  Future<String?> pay(Map data) {
    throw UnimplementedError('hasSDK has not been implemented.');
  }

  Future<String?> share(Map data) {
    throw UnimplementedError('hasSDK has not been implemented.');
  }

  //=======================内购类的==================================
  Future<String?> requestProduct(Map data) {
    throw UnimplementedError('hasSDK has not been implemented.');
  }

  Future<String?> queryProduct(Map data) {
    throw UnimplementedError('hasSDK has not been implemented.');
  }

  void onIPAEvent({void Function(Map)? onEvent}) {
    throw UnimplementedError('hasSDK has not been implemented.');
  }

  //================================================================
  Future<void> postEvent(Map data) {
    throw UnimplementedError('hasSDK has not been implemented.');
  }

  Future<BannerAd?> createBannerAd(Map data,
      {void Function(String)? onLoad,
      void Function()? onHide,
      void Function(String)? onError}) {
    throw UnimplementedError('hasSDK has not been implemented.');
  }

  Future<VideoAd?> createVideoAd(Map data,
      {void Function(String)? onLoad,
      void Function()? onReward,
      void Function()? onClose,
      void Function(String)? onError}) {
    throw UnimplementedError('hasSDK has not been implemented.');
  }

  Future<SplashAd?> createSplashAd(Map data,
      {void Function(String)? onLoad,
      void Function()? onClicked,
      void Function()? onDismissed,
      void Function(String)? onError}) {
    throw UnimplementedError('hasSDK has not been implemented.');
  }
  //================================================================
}
